Public Class adm_searchauditdetail
    Inherits System.Web.UI.Page
    Public aud_fd, aud_td As String
    Public aud_ft, aud_tt_copy As String
    Public bValidDates As Boolean
    Public objvalid As New gaValidation
    Public aUserSession(13) As String
    Public sess_cid, aff_cid, sess_gid, aff_gid As String
    Public sess_uid, aff_uid As String
    'Public aud_fd, aud_td As String
    Public aud_et As String
    Public aud_sip As String
    Public aud_rpp As String
    Public aud_do As String
    Public aud_rc As String
    Public aud_tt As String
    Public aud_aid As Integer
    Public sQS As String
    Public strHtml As String
    Dim oAudit As gaAudit.SearchAudit
    Public Const cSESSION_ID = 0
    Public Const cCOMPANY_ID = 1
    Public Const cGAPORTAL_ID = 2
    Public Const cUSER_ID = 3
    Public Const cINCIDCONTEXT = 4
    Public Const cINGIDCONTEXT = 5
    Public Const cLOGINDATETIME = 6
    Public Const cLASTACTIVITY = 7
    Public Const cUSERPERMISSIONSSTRING = 8
    'Public Const cTERMINAL_PIN = 9
    Public Const cROLE_ID = 9
    Public Const cMEMBER_TYPE = 10
    'Public Const cTERMINAL_NAME = 10
    Public Const cTERMINAL_NUMBER = 11
    Public Const cTERMINAL_MARKET = 12
#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        getparams()
        Display_results()
    End Sub
    Private Sub getparams()
        If Not IsNothing(Request.QueryString("sess_gid")) Then
            If aUserSession(cCOMPANY_ID) = "0" Then
                sess_cid = Trim(Request.QueryString("sess_cid"))
                aff_cid = Trim(Request.QueryString("aff_cid"))
            Else
                sess_cid = Application("CompanyID")
                aff_cid = Application("CompanyID")
            End If
            sess_gid = Trim(Request.QueryString("sess_gid"))
            aff_gid = Trim(Request.QueryString("aff_gid"))
            sess_uid = Trim(Request.QueryString("sess_uid"))
            aff_uid = Trim(Request.QueryString("aff_uid"))
            aud_fd = Trim(Request.QueryString("fd"))
            'aud_ft = Trim(Request.QueryString("ft"))
            aud_td = Trim(Request.QueryString("td"))
            'aud_tt = Trim(Request.QueryString("tt"))
            aud_et = Trim(Request.QueryString("et"))
            aud_sip = Trim(Request.QueryString("sip"))
            aud_rpp = CInt(Request.QueryString("rpp"))
            aud_do = Trim(Request.QueryString("do"))
            aud_rc = CInt(Request.QueryString("rc"))

            sQS = ""
            sQS = sQS & "?sess_gid=" & Server.UrlEncode(sess_gid)
            sQS = sQS & "&sess_cid=" & Server.UrlEncode(sess_cid)
            sQS = sQS & "&sess_uid=" & Server.UrlEncode(sess_uid)
            sQS = sQS & "&aff_gid=" & Server.UrlEncode(aff_gid)
            sQS = sQS & "&aff_cid=" & Server.UrlEncode(aff_cid)
            sQS = sQS & "&aff_uid=" & Server.UrlEncode(aff_uid)
            sQS = sQS & "&fd=" & Server.UrlEncode(aud_fd)
            'sQS = sQS & "&ft=" & Server.UrlEncode(aud_ft)
            sQS = sQS & "&td=" & Server.UrlEncode(aud_td)
            'sQS = sQS & "&tt=" & Server.UrlEncode(aud_tt)
            sQS = sQS & "&et=" & Server.UrlEncode(aud_et)
            sQS = sQS & "&sip=" & Server.UrlEncode(aud_sip)
            sQS = sQS & "&rpp=" & Server.UrlEncode(aud_rpp)
            sQS = sQS & "&do=" & Server.UrlEncode(aud_do)
        Else
            Response.Redirect("adm_searchaudit.asp")

        End If
    End Sub
    Private Sub Display_results()
        Dim auAID As String
        Dim auET As String
        Dim auDT As String
        Dim auSESS_UID As String
        Dim auSESS_CID As String
        Dim auSESS_GID As String
        Dim auAFF_UID As String
        Dim auAFF_CID As String
        Dim auAFF_GID As String
        Dim auDATA As String
        Dim Description As String

        Dim i As Integer
        Dim rst As New DataSet
        rst = oAudit.GetAuditDetails(CLng(aud_aid))
        If rst.Tables(0).Rows.Count > 0 Then
            auAID = rst.Tables(0).Rows(i).Item("Audit_ID")
            auET = rst.Tables(0).Rows(i).Item("EventDescription")
            auDT = rst.Tables(0).Rows(i).Item("DateTime")
            auSESS_UID = rst.Tables(0).Rows(i).Item("SESSION_User_ID")
            auSESS_CID = rst.Tables(0).Rows(i).Item("SESSION_Company_ID")
            auSESS_GID = rst.Tables(0).Rows(i).Item("SESSION_GAPORTAL_ID")
            auAFF_UID = rst.Tables(0).Rows(i).Item("AFFECTING_User_ID")
            auAFF_CID = rst.Tables(0).Rows(i).Item("AFFECTING_Company_ID")
            auAFF_GID = rst.Tables(0).Rows(i).Item("AFFECTING_GAPORTAL_ID")
            auDATA = rst.Tables(0).Rows(i).Item("Data")
        End If
        ''additional info
        rst = oAudit.GetAuditAdditionalInfo(CLng(aud_aid))
        If rst.Tables(0).Rows.Count > 0 Then
            For i = 0 To rst.Tables(0).Rows.Count - 1
                If Left((rst.Tables(0).Rows(i).Item("Description")), 4) = "New " Then
                    Description = Mid((rst.Tables(0).Rows(i).Item("Description")), 4)
                Else
                    Description = rst.Tables(0).Rows(i).Item("Description")
                End If
                strHtml = ""
                strHtml += "<tr><td valign='top'>"
                strHtml += "<font face='verdana, arial, helvetica' size='2'>" & Description & ">:</font>"

                strHtml += "</td><td>&nbsp;</td><td valign='top'>"

                strHtml += "<font face='verdana, arial, helvetica' size='2'>" & rst.Tables(0).Rows(i).Item("Data") & " ></font></td></tr>"
            Next
        End If

    End Sub
End Class
